package com.tinklabs.demo.adapter.multitype;

import android.support.annotation.NonNull;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import butterknife.BindView;
import me.drakeet.multitype.ItemViewBinder;
import me.drakeet.multitype.MultiTypeAdapter;

import com.tinklabs.demo.R;
import com.tinklabs.demo.adapter.viewholder.BaseViewHolder;
import com.tinklabs.demo.bean.CityGuideResult;

/**
 * Created by Jennifer on 2018/4/14.
 */

public class CityGuideNormalViewBinder extends ItemViewBinder<CityGuideResult.NormalItem, CityGuideNormalViewBinder.CityGuideViewHolder> {

    @NonNull
    @Override
    protected CityGuideViewHolder onCreateViewHolder(@NonNull LayoutInflater inflater, @NonNull ViewGroup parent) {
        View view = inflater.inflate(R.layout.city_guide_normal_item, parent, false);
        return new CityGuideViewHolder(view);
    }

    @Override
    protected void onBindViewHolder(@NonNull CityGuideViewHolder holder, @NonNull CityGuideResult.NormalItem item) {
        holder.img.setImageResource(R.mipmap.picture1);
        holder.title.setText(item.getStoreName());
        holder.content.setText(item.getDescription());
    }

    private void checkIfLoadMore(@NonNull CityGuideViewHolder holder) {
        int position = getPosition(holder);
        MultiTypeAdapter adapter = getAdapter();
        int itemCount = adapter.getItemCount();

        if (position >= itemCount - 1) {
        }
    }

    class CityGuideViewHolder extends BaseViewHolder {

        @BindView(R.id.city_guide_normal_item_img)
        ImageView img;

        @BindView(R.id.city_guide_normal_item_title)
        TextView title;

        @BindView(R.id.city_guide_normal_item_content)
        TextView content;

        CityGuideViewHolder(View itemView) {
            super(itemView);
        }
    }
}
